home *** CD-ROM | disk | FTP | other *** search
/ Alles Voor Internet / Tout Pour Internet / alles voor internet.iso / MacInternet™ / Unix / getit.shar / prnumich < prev    next >
Encoding:
Text File  |  1993-07-26  |  933 b   |  46 lines

  1. #!/usr/bin/perl
  2. $= = 999999;
  3. $first = 1;
  4. while (<>) {
  5.     chop;
  6.     if (m=^/=) {        # pathname -- starts new entry
  7.         if (!$first) {
  8.             $arr{$pathname} = $comment;
  9.         }
  10.         $pathname = $_;
  11.         $first = 0;
  12.         undef($comment);
  13.     }
  14.     elsif (/^\s*$/) {    # blank line
  15.         next;        # skip it
  16.     }
  17.     elsif (/^\s*\d+\s+\d+\/\d+\/\d+\s+[\w\d]+/) {    # Infoline
  18.         next;        # skip it
  19.     }
  20.     else {
  21.         m/^\s*(\S.*)\s*$/;    # take only good stuff
  22.         $comment = "$comment $1"; # append to comment
  23.     }
  24.         
  25. }
  26. @keys = keys(%arr);
  27. @keys = sort(@keys);
  28. foreach $key (@keys) {
  29.     $key =~ m=^(/.+/)([\w\.]+)\s*$=;    # find line components
  30.     $path = $1;
  31.     $filename = $2;
  32.     $comment = $arr{$key};
  33.     $comment =~ s/^\s*//;
  34.     write;                # print line components
  35. }
  36. format STDOUT_TOP =
  37. ascii
  38. .
  39. format STDOUT = 
  40. cd ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<~
  41. $path
  42. get ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<~
  43. $filename
  44. .
  45. # end of perl script 
  46.